<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <script src="${pageContext.request.contextPath}/static/jquery-3.5.1.js"></script>
    <script>
        $(function () {
            $("#btn").click(function (){
                $.get({
                    url:"http://localhost:8080/t2",
                    success:function (data) {
                        let html=null;
                        for (let i=0;i<data.length;i++){
                            html+="<tr>\n" +
                                "        <td>"+data[i].id+"</td>\n" +
                                "        <td>"+data[i].uname+"</td>\n" +
                                "        <td>"+data[i].pwd+"</td>\n" +
                                "        <td>"+data[i].levelid+"</td>\n" +
                                "    </tr>"

                        }
                        $("#data").html(html);
                    }
                })
            })
        })

    </script>
    <title>INDEX</title>
</head>
<body>
<a href="${pageContext.request.contextPath}/toLogin"><p>去登陆</p></a>
<input type="button" id="btn" value="查看">
<table style="border-spacing: 5px">
    <thead>
    <tr>
        <th>ID</th>
        <th>NAME</th>
        <th>PASSWORD</th>
        <th>LEVEL</th>
    </tr>

    </thead>
    <tbody id="data">
    <%--js数据填充--%>
    </tbody>
</table>
</body>
</html>
